package com.action;


import com.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MailAction {

    @Autowired
    private MailService  mailService;

    /**
     * 发送邮件
     * @param mail
     * @return
     */
    @RequestMapping("/sendMail")
    public String sendMail(String mail)
    {
        mailService.sendMail(mail);
        return "success";
    }


    @RequestMapping("/checkCode")
    public boolean checkCode(String mail, String code)
    {
        System.out.println(mail);
        System.out.println(code);
         boolean b = mailService.checkCode(mail,code);
         if (b)
         {
             //写数据库
         }
         return b;
    }
}
